package cn.opopopo.design_pattern_learn.行为型.中介者.demo2;

import cn.opopopo.design_pattern_learn.行为型.中介者.demo1.Colleague;
import cn.opopopo.design_pattern_learn.行为型.中介者.demo1.Mediator;

// 租客
public class Tenant extends Colleague {

    private double maxPrice;
    
    public Tenant(Mediator mediator, String name, double maxPrice) {
        super(mediator, name);
        this.maxPrice = maxPrice;
    }
    
    public double getMaxPrice() {
        return maxPrice;
    }
    
    @Override
    public void sendMessage(String message) {
        System.out.println("租客 " + name + " 发布需求: " + message);
        mediator.sendMessage(message, this);
    }
    
    @Override
    public void receiveMessage(String message, String from) {
        System.out.println("租客 " + name + " 收到信息: " + message + " (来自: " + from + ")");
    }
}